import request from '@/utils/request'

// 获取组织/公司列表
export const getOrganizeList = (data) => {
  return request({
    url: '/api/permission/Organize',
    method: 'GET',
    data
  })
}

//获取邀请码
export const getInvitationList = (data) => {
  return request({
    url: "/api/permission/Organize/Organize/invitation/list",
    method: "GET",
    data,
  });
};

// 获取组织/公司下拉框列表
export const getOrganizeSelector = (organizeId) => {
  return request({
    url: `/api/permission/Organize/Selector?organizeId=${organizeId}`,
    method: 'GET'
  })
}

// 获取组织/公司树形
export const getOrganizeTree = (organizeId) => {
  return request({
    url: `/api/permission/Organize/Tree?organizeId=${organizeId}`,
    method: 'GET'
  })
}

// 新建组织/公司
export const createOrganize = (data) => {
  return request({
    url: '/api/permission/Organize',
    method: 'POST',
    data
  })
}

// 修改组织/公司
export const updateOrganize = (data) =>{
  return request({
    url: `/api/permission/Organize/${data.id}`,
    method: 'PUT',
    data
  })
}

// 获取组织/公司信息
export const getOrganizeInfo = (id, organizeId) => {
  return request({
    url: `/api/permission/Organize/${id}?organizeId=${organizeId}`,
    method: 'GET'
  })
}

// 删除组织/公司
export const delOrganize = (id,organizeId) => {
  return request({
    url: `/api/permission/Organize/${id}?organizeId=${organizeId}`,
    method: 'DELETE'
  })
}

// 更新组织/公司状态
export const updateOrganizeState = (id,organizeId) => {
  return request({
    url: `/api/permission/Organize/${id}/Actions/State?organizeId=${organizeId}`,
    method: 'PUT'
  })
}
